      SUBROUTINE TRANS(A,B,C,R)
      IMPLICIT REAL*8 (A-H,O-Z)
C
C     SUBROUTINE TRANS IS TO SET UP THE TRANSFORMATION
C     MATRIX BETWEEN THE ARIES INERTIAL FRAME AND THE LOCAL
C     VERTICAL FRAME ,  IT CAN ALSO USED AS A 3-1-3 EULER TRANSFORMATION
C
      DIMENSION R(3,3)
      R(1,1)= DCOS(A)*DCOS(C) - DSIN(A)*DCOS(B)*DSIN(C)
      R(1,2)= -DCOS(A)*DSIN(C) - DSIN(A)*DCOS(B)*DCOS(C)
      R(1,3)= DSIN(A)*DSIN(B)
      R(2,1)= DSIN(A)*DCOS(C) + DCOS(A)*DCOS(B)*DSIN(C)
      R(2,2)= -DSIN(A)*DSIN(C) + DCOS(A)*DCOS(B)*DCOS(C)
      R(2,3) = -DCOS(A)*DSIN(B)
      R(3,1)= DSIN(B)*DSIN(C)
      R(3,2)= DSIN(B)*DCOS(C)
      R(3,3)= DCOS(B)
      RETURN
      END
